<template>
  <div class="menu-warp">
    <div class="menus-ui" v-for="(val) in menusList" :key="val.path">
      <div class="menus-two">
        <template v-if="val.children">
          <span>{{ val.name }}</span>
        </template>
        <template v-else>
          <router-link :to="val.path">{{ val.name }}</router-link>
        </template>
      </div>
      <template v-if="val.children">
        <div class="menus-item" v-for="(item) in val.children" :key="item.path">
          <router-link :to="item.path">{{ val.name }}</router-link>
        </div>
      </template>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  name: 'Menus',
  data () {
    return {}
  },
  computed: {
    ...mapGetters(['menusList'])
  },
  watch: {}
}
</script>

<style scoped lang="scss">
.menu-warp {
  width: 200px;
  .menus-ui {
    display: flex;
    flex-direction: column;
    .menus-two {
      width: 100px;
      padding: 10px;
      box-sizing: border-box;
    }
    .menus-item {
      padding: 10px;
      box-sizing: border-box;
    }
  }
}
</style>
